﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>INotifyPropertyChanged</Title>
			<Shortcut>inotify</Shortcut>
			<Description>属性通知客户端类</Description>
			<Author>Microsoft Corporation</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Declarations>
			</Declarations>
			<Code Language="csharp"><![CDATA[
public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string propertyName)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected void SetProperty<T>(ref T item, T value, [CallerMemberName] string propertyName = null)
{
    if (!EqualityComparer<T>.Default.Equals(item, value))
    {
        item = value;
        OnPropertyChanged(propertyName);
    }
}
]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>
